package com.ymatou.iapi.payment.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.payment.parameter.QueryGodMchNoBean;
import com.ymatou.iapi.payment.service.QueryGodMchNoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.PayGateWayCallService;
/**
*神器商户号查询
*FreeMaker Template自动生成代码
*/
@TestSuite
@Ignore
//码头神器站点拆分
public class Ts_QueryGodMchNo{
	private static QueryGodMchNoBean querygodmchnoBean;
	private static QueryGodMchNoCall querygodmchnoCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("神器商户号查询");
	}

	@Before
	public void caseUp() {
		querygodmchnoBean=new QueryGodMchNoBean();
		querygodmchnoCall=new QueryGodMchNoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(querygodmchnoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryGodMchNo_001() {
		Logger.start(true,"神器商户号查询成功wxsqBuyer");
		try {
			querygodmchnoBean.setAppName("wxsqBuyer");
			querygodmchnoCall.setData(querygodmchnoBean);
			querygodmchnoCall.callService();			
			Logger.verifyEquals("0", querygodmchnoCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyEquals(PayGateWayCallService.GdDefMerchantNo, querygodmchnoCall.getJsonObject().get("Result").getAsJsonObject().get("MchNo").getAsString(),"验证返回");
			Logger.verifyEquals(1, querygodmchnoCall.getJsonObject().get("Result").getAsJsonObject().get("GodPayType").getAsInt(),"验证返回GodPayType");
			 /**
		     * 公版小程序
		     */
//		    PUBLIC_WXAPP(1),

		    /**
		     * 独立小程序
		     */
//		    INDEPENDENT_WXAPP(2),

		    /**
		     * 公版H5
		     */
//		    PUBLIC_H5(3),

		    /**
		     * 独立H5
		     */
//		    INDEPENDENT_H5(4);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_QueryGodMchNo_002() {
		Logger.start(true,"神器商户号查询成功h5sqBuyer");
		try {
			querygodmchnoBean.setAppName("h5sqBuyer");
			querygodmchnoCall.setData(querygodmchnoBean);
			querygodmchnoCall.callService();			
			Logger.verifyEquals("0", querygodmchnoCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyEquals(PayGateWayCallService.GdDefMerchantNo, querygodmchnoCall.getJsonObject().get("Result").getAsJsonObject().get("MchNo").getAsString(),"验证返回");
			Logger.verifyEquals(3, querygodmchnoCall.getJsonObject().get("Result").getAsJsonObject().get("GodPayType").getAsInt(),"验证返回GodPayType");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_QueryGodMchNo_003() {
		Logger.start(true,"神器商户号查询成功-独立小程序");
		try {
			querygodmchnoBean.setAppName(PayGateWayCallService.GdSq);
			querygodmchnoCall.setData(querygodmchnoBean);
			querygodmchnoCall.callService();			
			Logger.verifyEquals("0", querygodmchnoCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyEquals(PayGateWayCallService.GdDefMerchantNo, querygodmchnoCall.getJsonObject().get("Result").getAsJsonObject().get("MchNo").getAsString(),"验证返回");
			Logger.verifyEquals(2, querygodmchnoCall.getJsonObject().get("Result").getAsJsonObject().get("GodPayType").getAsInt(),"验证返回GodPayType");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_QueryGodMchNo_004() {
		Logger.start(true,"不输入AppName失败");
		try {
			querygodmchnoCall.setData(querygodmchnoBean);
			querygodmchnoCall.callService();			
			Logger.verifyEquals("1000", querygodmchnoCall.getString("ErrorCode"), "验证ErrorCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_QueryGodMchNo_005() {
		Logger.start(true,"神器商户号查询成功-独立小程序-带参数SellerId");
		try {
			querygodmchnoBean.setAppName(PayGateWayCallService.GdSq);
			//?这个参数的作用？
			querygodmchnoBean.setSellerId(Integer.valueOf(PayGateWayCallService.GdSq));
			querygodmchnoCall.setData(querygodmchnoBean);
			querygodmchnoCall.callService();			
			Logger.verifyEquals("0", querygodmchnoCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyEquals(PayGateWayCallService.GdDefMerchantNo, querygodmchnoCall.getJsonObject().get("Result").getAsJsonObject().get("MchNo").getAsString(),"验证返回");
			Logger.verifyEquals(2, querygodmchnoCall.getJsonObject().get("Result").getAsJsonObject().get("GodPayType").getAsInt(),"验证返回GodPayType");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}